from pyapollo import ApolloClient
apolloClient = ApolloClient(app_id='EZR.Arch.ECollectRCsms.ApiHost',
                                config_server_url='http://192.168.128.156:8080',
                                admin_server_url='http://192.168.12.127:8090',
                                env='FAT',
                                cycle_time=10,
                                # exceptNamespaces='Architecture.Common',
                                namespaces=['application'],
                                timeout=6,
                                logger=None,
                                )
class config:
    WorkTime='1234'
c=config()
apolloClient.add_listener(c)
apolloClient.start()
apolloClient.watch_key_change('WorkTime',lambda x:print(f'WorkTime is changed to {x}'))

import time
while True:
    time.sleep(5)
    v = apolloClient.get_value('WorkTime','1')
    print('---------',v)
    print('----c.WorkTime-----',c.WorkTime)